import Love from "../love/love"
var love = new Love("title")
import sheet from "../data/res"
love.loader.loadFromSheet(sheet)
love.enter = function(){
  love.graphics.setDesignResolution(1600, 900)
  this.anykey = love.loader.data.font50
  this.titleW = love.loader.data.font100.getWidth("急速狂飙")
  this.anykeyW = love.loader.data.font50.getWidth("【轻触屏幕继续】")
  this.bg = love.loader.getRes("bg")
  this.c = {r : 255, b : 255 , g : 255 , a : 0 }
}
love.update = function (dt) {
}
let da = 0.01
love.draw = function () {
  var bgDim = this.bg.getDimentions()
  var scDim = love.graphics.getDimensions()
  love.graphics.setColor("white")
  love.graphics.draw(this.bg,0,0,0,1600/bgDim.w,900/bgDim.h)
  love.graphics.setFont(love.loader.data.font100)
  love.graphics.print("急速狂飙", 800- love.titleW / 2, 400)
  love.graphics.setColor("red")
  love.graphics.printOutline("急速狂飙", 800 - love.titleW / 2, 400)
  love.graphics.setFont(love.loader.data.font50)
  this.c.a = this.c.a + da
  if (this.c.a >= 1 || this.c.a<=0) {
    da = -da
    this.c.a = this.c.a + da
  } 
  love.graphics.setColor(this.c)
  love.graphics.print("【轻触屏幕继续】", 800 - love.anykeyW / 2, 550)
}
love.touch.onTouch = function (touches) {
  love.switch("main")
}

export default love